<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/9
 * Time: 14:31
 */

namespace app\common\model;


use think\Model;

class GamePvp extends Model
{
    protected $name = 'game_pvp';
    protected $hidden = [
        'createtime','updatetime'
    ];
    protected $append = [
        'sex_name','magic_name','num_name','type_name'
    ];
    public function getSexNameAttr($value,$data)
    {
        switch ( $data['sex'] ){
            case 'woman':
                return '女';
                break;
            case 'man':
                return '男';
                break;
        }
    }
    public function getMagicNameAttr($value,$data)
    {
        switch ( $data['magic'] ){
            case 1:
                return '有';
                break;
            case 0:
                return '无';
                break;
        }
    }

    public function getNumNameAttr($value,$data)
    {
        switch ( $data['num'] ){
            case 'double':
                return '双';
                break;
            case 'single':
                return '单';
                break;
        }
    }
    public function getTypeNameAttr($value,$data)
    {
        switch ( $data['type'] ){
            case 'close':
                return '近战';
                break;
            case 'far':
                return '远程';
                break;
        }
    }
}